package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShoppingCartService;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.simpleframework.xml.Path;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/shop")
@Api(tags = "店铺相关接口")
@Slf4j
public class ShopController {
    @Autowired
    private ShoppingCartService shoppingCartService;

    /**
     * 获取营业状态
     *
     * @return R
     */
    @GetMapping("/status")
    public Result<Integer> getStatus() {
        Integer status = shoppingCartService.getStatus();
        return Result.success(status);
    }

    /**
     * 设置营业状态
     *
     * @param status 1为营业，0为打烊
     * @return R
     */
    @PutMapping("/{status}")
    public Result update(@PathVariable Integer status) {
        shoppingCartService.update(status);
        return Result.success();
    }
}

